<template>
  <el-tabs v-model="activeNameHuiqian" @tab-click="tabClick" tab-position="left">
    <el-tab-pane name="Fangan">
      <span slot="label">方案 <i class="el-icon-caret-bottom"></i></span>
      <hq-fanganbaosong :timestamp="subtimestamp" />
    </el-tab-pane>
    <el-tab-pane name="HQ_XueXi">
      <span slot="label">学习研讨 <i class="el-icon-caret-bottom"></i></span>
      <hq-xuexi :timestamp="subtimestamp" />
    </el-tab-pane>
    <!-- <el-tab-pane name="HQ_YiJian">
      <span slot="label">征求意见 <i class="el-icon-caret-bottom"></i></span>
      <hq-yijianyuanshi :timestamp="subtimestamp" />
    </el-tab-pane> -->
    <el-tab-pane name="HQ_TanHua">
      <span slot="label">开展谈心谈话 <i class="el-icon-caret-bottom"></i></span>
      <hq-tanhua :timestamp="subtimestamp" :leaders="leaders" />
    </el-tab-pane>
    <el-tab-pane name="HQ_CaiLiaoBanZi">
      <span slot="label">班子材料及审核情况 <i class="el-icon-caret-bottom"></i></span>
      <hq-cailiaobanzi :timestamp="subtimestamp" />
    </el-tab-pane>
    <el-tab-pane name="HQ_CaiLiaoChengYuan">
      <span slot="label">班子成员材料及审核情况 <i class="el-icon-caret-bottom"></i></span>
      <hq-cailiaochengyuan :timestamp="subtimestamp" />
    </el-tab-pane>
  </el-tabs>
</template>
<script>
import HqXuexi from './hqXuexi.vue'
import hqFanganbaosong from './hqFanganbaosong.vue'
import HqYijianyuanshi from './hqYijianyuanshi.vue'
import HqTanhua from './hqTanhua.vue'
import HqCailiaochengyuan from './hqCailiaochengyuan.vue'
import HqCailiaobanzi from './hqCailiaobanzi.vue'
export default {
  components: { hqFanganbaosong, HqXuexi, HqYijianyuanshi, HqTanhua, HqCailiaochengyuan, HqCailiaobanzi },
  props: {
    timestamp: '',
    leaders: []
  },
  data () {
    return {
      subtimestamp: null,
      topersonlist: [],
      activeNameHuiqian: 'Fangan',
      huiqiandata: {
        Fangan: {},
        HS_HuiYiYiCheng: {}
      },
      Fangansrc: '',
      showPDFVisible: false,
      YijianDuixiang: '全部',
      sublistLoading: false,
      listLoading: false,
      BanziPersonName: '全部',
      pdfviewersrc: '',
      TanhuaDuixiang: '全部',
      pdfpage: 1,
      FujianFilename: '',
      pdfviewersrcFujian: '',
      showPDFVisibleFujian: false
    }
  },
  watch: {
    '$store.state.link_hq' (val) {
      this.activeNameHuiqian = this.$store.state.link_hq
    }
    // $refs.tree2.getCurrentNode()
  },
  computed: {
    filterList: function () {
      let key = this.BanziPersonName
      let key2 = this.TanhuaDuixiang
      let oldList = this.huiqiandata.HQ_TanHua
      if (key === '全部' && key2 === '全部') {
        return oldList
      }
      if (key2 === '全部') {
        return oldList.filter(function (item) {
          return item.BanziPersonName === key
        })
      }
      if (key === '全部') {
        return oldList.filter(function (item) {
          return item.Duixiang === key2
        })
      }
      return oldList.filter(function (item) {
        return item.Duixiang === key2 && item.BanziPersonName === key
      })
    },
    dxfilterList: function () {
      let key = this.YijianDuixiang
      let oldList = this.huiqiandata.HQ_YiJianYuanShi
      if (key === '全部') {
        return this.huiqiandata.HQ_YiJianYuanShi
      }
      return oldList.filter(function (item) {
        return item.Fanweileixing === key
      })
    },
    SumYijianTiaoshu: function () {
      let s = 0
      if (this.dxfilterList) {
        this.dxfilterList.forEach(function (val) {
          s += val.Tiaoshu
        })
      }
      return s
    }
  },
  methods: {
    tabClick () {
      this.subtimestamp = new Date().getTime()
      var params = {Link_hq: this.activeNameHuiqian}
      this.$store.commit('tablink_hq', params)
    }
  },
  mounted () {
    this.tabClick()
  }
}
</script>
<style scoped>
.el-form-item{
  margin:0;
}
</style>
